package com.gec.yhzh.service.impl;

import com.gec.yhzh.entity.AppointmentVaccine;
import com.gec.yhzh.mapper.AppointmentVaccineMapper;
import com.gec.yhzh.service.IAppointmentVaccineService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 可预约疫苗列表 服务实现类
 * </p>
 *
 * @author jerry
 * @since 2025-03-10
 */
@Service
public class AppointmentVaccineServiceImpl extends ServiceImpl<AppointmentVaccineMapper, AppointmentVaccine> implements IAppointmentVaccineService {
    @Autowired
    private AppointmentVaccineMapper appointmentVaccineMapper;

    @Override
    public List<AppointmentVaccine> findListByParams(String vaccineId, String address) {
        Map<String, Object> params = new HashMap<>();
        if (vaccineId != null && !vaccineId.isEmpty()) {
            params.put("vaccineId", vaccineId);
        }
        if (address != null && !address.isEmpty()) {
            params.put("address", address);
        }

        // 从数据库查询数据
        return appointmentVaccineMapper.selectByParams(params);
    }
}
